package com.miplus.ccrm.core.service.cust;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.miplus.ccrm.core.controller.vo.LabelResVo;
import com.miplus.ccrm.core.pojo.ConCustomerGrpTag;
import com.miplus.ccrm.core.service.cust.ConCustomerGrpTagService;
import com.miplus.ccrm.core.mapper.ConCustomerGrpTagMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author wangzl
* @description 针对表【con_customer_grp_tag】的数据库操作Service实现
* @createDate 2024-11-08 12:52:48
*/
@Service
public class ConCustomerGrpTagServiceImpl extends MPJBaseServiceImpl<ConCustomerGrpTagMapper, ConCustomerGrpTag>
    implements ConCustomerGrpTagService{
    @Override
    public void deleteCustomerGrpTag(String sql, String tag)
    {
        baseMapper.deleteCustomerGrpTag(sql, tag);
    }

    @Override
    public void addCustomerGrpTag(String sql, String tag)
    {
        baseMapper.addCustomerGrpTag(sql, tag);
    }

    @Override
    public List<LabelResVo> getCustGrpTagList() {
        return selectJoinList(LabelResVo.class,new MPJLambdaWrapper<>(ConCustomerGrpTag.class)
                .selectAs(ConCustomerGrpTag::getGrpTag,LabelResVo::getLabel)
                .selectAs(ConCustomerGrpTag::getGrpTag,LabelResVo::getValue)
                .groupBy(ConCustomerGrpTag::getGrpTag)
        );
    }
}




